package com.qfedu.common.core.common;

import lombok.Data;

@Data
public class Result {
	private Integer code; // 编码: 1成功,0失败
	private String msg; // 错误信息

	private String username;    // 用户名
	private String token;   // 用户认证token
	private Long tokenExpired; // token过期时间戳
	private Object data; // 封装的数据

	public static Result success() {
		Result result = new Result();
		result.code = 200;
		result.msg = "success";
		result.username = "超级无敌张恒阳大王";
		result.token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI2MDZlOWY3MDgwYjg0NTAwMDFlODBkODEiLCJyb2xlIjpbInVzZXIiXSwidGVuYW50SWQiOiIiLCJpYXQiOjE2MjI0NjE0MzQsImV4cCI6MTYyMjQ2ODYzNH0.signature_string";
		result.tokenExpired = 1672531200000L;
		return result;
	}


	public static Result success(Object data) {
		Result result = success();
		result.data = data;
		return result;
	}

	public static Result error(String msg) {
		Result result = new Result();
		result.code = 500;
		result.msg = msg;
		return result;
	}



}
